package com.i2works.smartluolong.web.service.cart.impl;

import com.i2works.smartluolong.utils.basecommon.BaseCommonServiceImpl;
import com.i2works.smartluolong.utils.exception.DAOException;
import com.i2works.smartluolong.utils.exception.ServiceException;
import com.i2works.smartluolong.web.dal.cart.dao.ICartReceiveDAO;
import com.i2works.smartluolong.web.entity.cart.CartReceiveDO;
import com.i2works.smartluolong.web.entity.cart.CartReceiveQuery;
import com.i2works.smartluolong.web.service.cart.ICartReceiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 执照领取记录表实现类
 *
 * @author Liu Yutao <koal@vip.qq.com>
 * @date 2018/5/22 11:52
 */

@Service("cartReceiveService")
public class CartReceiveServiceImpl extends BaseCommonServiceImpl<CartReceiveQuery, CartReceiveDO> implements ICartReceiveService {

    @Autowired
    private ICartReceiveDAO cartReceiveDAO;

    /**
     * 根据身份证查询执照领取记录表
     */
    @Override
    public List<CartReceiveDO> queryCartListByIdcard(CartReceiveQuery query) throws ServiceException {
        try {
            return cartReceiveDAO.queryCartListByIdcard(query);
        } catch (DAOException e) {
            throw new ServiceException(e);
        }
    }

    /**
     * 根据身份证查询执照领取记录数量
     */
    @Override
    public Integer queryCartListByIdcardCount(CartReceiveQuery query) throws ServiceException {
        try {
            return cartReceiveDAO.queryCartListByIdcardCount(query);
        } catch (DAOException e) {
            throw new ServiceException(e);
        }
    }
}
